package com.ssyan;

/**
 * @author ssyan
 * @Description 类的加载过程中初始化阶段 -- 类构造器方法,父类与子类的加载顺序
 * @create 2021/8/16 0:11
 * @Version 1.0
 */
public class ClinitFatherSonTest {
    static class Father{
        public static int A = 1;
        static {
            A = 2;
        }
    }

    static class Son extends Father {
        public static int B = A;
    }

    public static void main(String[] args) {
        //先加载Father类，其次加载Son类
        System.out.println(Son.B);//2
    }
}
